package se.gala.rng;

import java.io.Serializable;

import ec.util.MersenneTwisterFast;

final class GGRandom implements Serializable {
	private static final long serialVersionUID = 5524035174395059117L;
	private long seed;
	private MersenneTwisterFast rng;
	
	public GGRandom() {
		rng = new MersenneTwisterFast();
		seed = nextLong();
		rng.setSeed(seed);
	}

	public GGRandom(long seed) {
		rng = new MersenneTwisterFast(seed);
		this.seed = seed;
	}

	public long getSeed() {
		return this.seed;
	}
	
	public long nextLong() {
		return rng.nextLong();
	}

	public boolean nextBoolean() {
		return rng.nextBoolean();
	}

	public int nextInt(int bound) {
		return rng.nextInt(bound);
	}
}